|
|
|
|
|
|
|
(table continued from previous page) |
|
|
|
|
| handles are stored in long variables. You will almost never actually access the data a HANDLE points to; that data is almost always used internally by Windows.4 | typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef WORD far *LPWORD;
typedef DWORD far *LPDWORD; | AWORD is a 16-bit unsigned short variable. An LPWORD points to a WORD. A DWORD is a 32-bit unsigned long variable. An LPDWORD points to a DWORD. | typedef DWORD LCID;
typedef PDWORD PLCID; | LCID stands for locale identifier, a number that indicates a particular language and country. An LCID is also a 32-bit long value, but by using LCID instead of long, the data type becomes more clear to programmers trying to read the code. A PLCID is a pointer to an LCID. | | Table T6-4: Common Windows data types |
|
|
|
|
|
|
Now that you have a good understanding of how C defines different types of data, let's take a quick look at how you might convert data from C to Visual Basic. The key thing to remember is the only thing you really have to know is the length of the data variable. Don't get confused with the complex notation of various C data types. The goal of showing them in the preceding section was to give you the tools to figure out what fundamental data type the derived type is based on. Table T6-5 shows the Visual Basic data types that most closely correspond to the built-in C data types. |
|
|
|
|
| C DATA TYPE | VISUAL BASIC EQUIVALENT | | char | Byte | | short | Integer |
|
|
|
|
|
|
(table continued on next page) |
|
|
|
 |
|
 |
|
|
4 If the data that a HANDLE points to is never used by an application, why is a HANDLE defined as a pointer instead of a Long? Actually, in earlier versions of Windows, it was a Long value. But by changing it to a pointer, Microsoft was able to define many different types of handles as pointers to different structures. The C compiler could detect attempts to pass one type of handle to functions expecting a different type of handle. This helped eliminate careless programming errors such as passing device context handles to functions expecting window handles. |
|
|
|
|
|